package Classes.GameViews.ViewIcons// ActionScript file
{
	import Classes.GameDatas.GD_Item;
	import Classes.GameDatas.GD_Weapon;
	import Classes.Interfaces.I_Observer;

	public class VI_Item extends ViewIcon implements I_Observer
	{
		private var _item:*;
		public function VI_Item(item:*):void
		{
			super(item.sourceName,item.picName);
			this._item=item;
			
			this.init();
		}
		
		private function init():void
		{
			this.showNum();
			this.item.addObserver("itemNumber",this);
		}
		
		public function touchObserve(observeType:String):void
		{
			switch(observeType)
			{
				case "itemNumber":
					this.showNum();
					break;
			}
		}
		
		private function showNum():void
		{
			if(this.item.itemId==GD_Weapon.defaultWeapon)
				this.type=2;
			
			this.setNum(this.item.itemNumber);
		}
		
		public function cleanAllObserves():void
		{
			this.item.removeObserver("itemNumber",this);
		}
		
		override public function release():void
		{
			this.cleanAllObserves();
			super.release();
			this._item=null;
		}
		
		/*getter & setter*/
		public function get item():*
		{
			return _item;
		}

	}
}